//
//  MyMessageViewController.m
//  PT
//
//  Created by jarze on 15/6/11.
//  Copyright (c) 2015年 jarze. All rights reserved.
//

#import "MyMessageViewController.h"
#import "CTTableViewCell.h"
#import "MeItem.h"
#import "NextItem.h"
#import "MeTableViewCell.h"
#import "MyMessageItem.h"



@interface MyMessageViewController ()

@end

@implementation MyMessageViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self addGroup];
}


- (void)addGroup
{
    
    MeItem *item = [[MyMessageItem alloc] initWithIcon:@"Image" title:@"2015-05-12 14:00" subTitle:@"在吗"];
    MeItem *item1 = [[MyMessageItem alloc] initWithIcon:@"Image1" title:nil subTitle:@"8.5分"];
    MeItem *item2 = [[MyMessageItem alloc] initWithIcon:@"Image2" title:@"casnvdfjsn" subTitle:nil];
    
    MeItem *item3 = [[MyMessageItem alloc] initWithIcon:@"Image" title:@"casnvdfjsn" subTitle:@"8.5分"];
    
    Group *group = [[Group alloc] init];
//    group.items = @[item, item1, item2,item3];
    [group.items addObjectsFromArray:@[item, item1, item2,item3]];

    [self.datas addObject:group];
    
    
    
}
- (id)init
{
    return [super initWithStyle:UITableViewStyleGrouped];
    
    
}
- (id)initWithStyle:(UITableViewStyle)style
{
    return [super initWithStyle:UITableViewStyleGrouped];
    
}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
        return 0.1;
  
    
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 60;
    
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    CTTableViewCell *cell = [CTTableViewCell cellWithTableView:self.tableView];
    
    Group *g = self.datas[indexPath.section];
    
    //  从组模型中取出对应行的模型
    MeItem *item = g.items[indexPath.row];
    cell.meItem = item;
    
    cell.meItem = g.items[indexPath.row];
    return cell;
}


@end
